home *** CD-ROM | disk | FTP | other *** search
- function units_robot_setup()
- units_setup(7,false,ENET_EFFECT_PS_SETUPSMOKE_LARGE,ENET_EFFECT_GEOMETRY_ROBOTSHADOW)
- units_reloadfirespots(uniGetExecutor(),2,ENET_EFFECT_BULLET_ROBOTROCKET)
- end
-
- function units_robot_resetup()
- units_setup(7,false,nil,ENET_EFFECT_GEOMETRY_ROBOTSHADOW)
- units_reloadfirespots(uniGetExecutor(),2,ENET_EFFECT_BULLET_ROBOTROCKET)
- end
-
- function units_robot_select()
- units_select(22,2)
- end
-
- function units_robot_unselect()
- units_unselect()
- end
-
- function units_robot_selectenemy()
- uniGetExecutor():addSimpleEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY)
- end
-
- function units_robot_damaged()
- uniGetExecutor():applyDamage(uniGetLife())
- end
-
- function units_robot_highlight()
- uniGetExecutor():addEffectWithRadius(ENET_EFFECT_GEOMETRY_HIGHLIGHT,15)
- end
-
- function units_robot_explode()
- --units_explode_big()
- units_explode_big1()
- end
-
- function units_robot_move()
- local unit = uniGetExecutor()
- local steps = {}
- local i = 0;
- steps[0] = unit:getBone(ENBT_STEPEMITTER,0):addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_ROBOTSTEPSEMITTER_RIGHT)
- steps[1] = unit:getBone(ENBT_STEPEMITTER,1):addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_ROBOTSTEPSEMITTER_LEFT)
- local sound = unit:play3DSound("robot_rotate.wav",1)
- unit:addAnimationToQueue(ENAT_TURNING,MATH_INFINITY)
- waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNIT,MATH_PI * 0.7))
- unit:addAnimationToQueue(ENAT_GO,MATH_INFINITY)
- unit:setCurrentAnimationRepeatCount(0)
- for i = 0,1 do
- steps[i+2] = unit:getBone(ENBT_STEPEMITTER,i):addSimpleEffect(ENET_EFFECT_PS_TRACKSMOKE)
- end
- waitDeath(unit:addMoveEffect(ENET_EFFECT_MOVE_LINEAR,80))
- unit:setCurrentAnimationRepeatCount(0)
- sound:destroy()
- unit:play3DSound("robot_stop.wav",0):destroy()
- for i = 0,1 do
- if(unit:getScale() < 1.0) then
- steps[i]:destroy()
- else
- steps[i]:setTransformOwner()
- steps[i]:suspendedDestroy(70)
- end
- steps[i+2]:suspendedDestroy(1.0)
- end
- end
-
- function units_robot_fire1()
- local unit = uniGetExecutor()
- local gt = unit:getBone(ENBT_GUNTOWER)
- local sound = gt:play3DSound("robot_guntower_rotate.wav",1)
- waitDeath(gt:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERTOTARGET,MATH_PI,uniGetTarget()))
- sound:stopSound()
- waitDeath(gt:getBone(ENBT_GUN):addRotationEffect(ENET_EFFECT_ROTATE_GUNTOTARGET,MATH_PI / 3.0,uniGetTarget()))
- gt:getBone(ENBT_FIRE1):addBulletEffect(ENET_EFFECT_BULLET_HEAVYLASERRAY_RED):executeCommand(ENC_FIRE1)
- unit:addFireArrow()
- end
-
- function units_robot_fire1_new()
- local unit = uniGetExecutor()
- local sound = unit:play3DSound("robot_rotate.wav",1)
- unit:addAnimationToQueue(ENAT_TURNING,MATH_INFINITY)
- waitDeath(unit:parabolicTargetting(uniGetTarget(),unit:getBone(ENBT_FIRE1),MATH_PI * 0.7))
- unit:setCurrentAnimationRepeatCount(1)
- while(unit:getCurrentAnimation() == ENAT_TURNING) do pause() end
- sound:stopSound()
- waitDeath(unit:getBone(ENBT_GUN):addRotationEffect(ENET_EFFECT_ROTATE_GUNTOTARGET,MATH_PI / 3.0,uniGetTarget()))
- local firespot = unit:getBone(ENBT_FIRE1)
-
- firespot:addSimpleEffect(ENET_EFFECT_HEAVYBOT2SHOT_FLY):executeCommand(ENC_FIRE1)
-
- unit:addFireArrow()
- end
-
- function units_robot_fire2()
- local unit = uniGetExecutor()
- uniSetLife(uniGetLife() / 4.0)
- if(unit:getObjectPositionInLocalSpace(uniGetTarget()).z < 0) then
- local sound = unit:play3DSound("robot_rotate.wav",1)
- unit:addAnimationToQueue(ENAT_TURNING,MATH_INFINITY)
- waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNITTOTARGET,MATH_PI * 0.7,uniGetTarget()))
- unit:setCurrentAnimationRepeatCount(1)
- while(unit:getCurrentAnimation() == ENAT_TURNING) do pause() end
- sound:stopSound()
- end
- local f_pause = 0.35
- unit:getBone(ENBT_FIRE2,0):findEffect(ENET_EFFECT_BULLET_ROBOTROCKET):executeCommand(ENC_FIRE1)
- pause(f_pause)
- unit:getBone(ENBT_FIRE2,3):findEffect(ENET_EFFECT_BULLET_ROBOTROCKET):executeCommand(ENC_FIRE1)
- pause(f_pause)
- unit:getBone(ENBT_FIRE2,1):findEffect(ENET_EFFECT_BULLET_ROBOTROCKET):executeCommand(ENC_FIRE1)
- pause(f_pause)
- unit:getBone(ENBT_FIRE2,2):findEffect(ENET_EFFECT_BULLET_ROBOTROCKET):executeCommand(ENC_FIRE1)
- pause(1.0)
- units_reloadfirespots(uniGetExecutor(),2,ENET_EFFECT_BULLET_ROBOTROCKET)
- unit:addFireArrow()
- end
-
- registerCommand(ENSCRIPTSET_ROBOT,ENC_MOVE,"units_robot_move")
- registerCommand(ENSCRIPTSET_ROBOT,ENC_FIRE1,"units_robot_fire1_new")
- registerCommand(ENSCRIPTSET_ROBOT,ENC_FIRE2,"units_robot_fire2")
- registerCommand(ENSCRIPTSET_ROBOT,ENC_SELECT,"units_robot_select")
- registerCommand(ENSCRIPTSET_ROBOT,ENC_SELECTENEMY,"units_robot_selectenemy")
- registerCommand(ENSCRIPTSET_ROBOT,ENC_UNSELECT,"units_robot_unselect")
- registerCommand(ENSCRIPTSET_ROBOT,ENC_SETUP,"units_robot_setup")
- registerCommand(ENSCRIPTSET_ROBOT,ENC_RESETUP,"units_robot_resetup")
- registerCommand(ENSCRIPTSET_ROBOT,ENC_DAMAGED,"units_robot_damaged")
- registerCommand(ENSCRIPTSET_ROBOT,ENC_EXPLODE,"units_robot_explode")
- registerCommand(ENSCRIPTSET_ROBOT,ENC_HIGHLIGHT,"units_robot_highlight")
- registerCommand(ENSCRIPTSET_ROBOT,ENC_INSIDE,"units_inside")
-
- -- make description of unit
- desc = getEffectDescriptionP(ENET_UNIT_ROBOT)
- desc.ClassID = ENCLASS_MESHINSTANCE
- desc.EffectClassType = ENECT_GEOMETRY
- desc.FileName = "robot.rmd"
- desc.ScriptSet = ENSCRIPTSET_ROBOT
- desc.MoveType = ENMOVE_GROUND
- desc.RenderType = ENRENDERTYPE_GEOMETRY
- desc.Material = ENMAT_RIGIDSKINNEDMESH
- desc.MaterialColors = units_materialcolors_human
-
- -- shadow
- desc = getEffectDescriptionP(ENET_EFFECT_GEOMETRY_ROBOTSHADOW)
- desc.ClassID = ENCLASS_MESHINSTANCE
- desc.EffectClassType = ENECT_GEOMETRY
- desc.FileName = "robot_shadow.rmd"
- desc.RenderType = ENRENDERTYPE_SHADOW
- desc.Material = ENMAT_SHADOW
- desc.MaterialColors = units_materialcolors_shadow
-
- ------------------------------------------------------------------------------------------------------
- ------------------------ effects related to unit------------------------------------------------------
- ------------------------------------------------------------------------------------------------------
-
- function bullets_robotrocket_fire()
- local bullet = uniGetExecutor()
- bullet:setTransformOwner()
- --local engine = bullet:addSimpleEffect(ENET_EFFECT_ORIENTEDSPRITE_ROCKETENGINEFIRE)
- local light = bullet:addSimpleEffect(ENET_EFFECT_LIGHT_ROCKETENGINE)
- -- local sound = bullet:play3DSound("smallrocket_fly.wav",1)
- bullet:play3DSound("smallrocket_fly.wav",0)
- local track = bullet:addSimpleEffect(ENET_EFFECT_PS_ROCKETENGINE2)
- -- waitDeath(bullet:addMoveEffect(ENET_EFFECT_MOVE_ROCKETFLY,250,uniGetTarget()))
- waitDeath(bullet:rocketFly(uniGetTarget():getBone(ENBT_TARGET):getWorldPosition()))
- -- sound:destroy()
- light:destroy()
- --engine:destroy()
- track:suspendedDestroy(1.0)
- bullet:play3DSound("smallrocket_explode.wav",0):destroy()
- bullet:setVisibility(false,true)
- bullet:addSimpleEffect(ENET_EFFECT_LIGHT_ROCKETEXPLODE):delayedDestroy(1.0)
- bullet:addSimpleEffect(ENET_EFFECT_PS_ROCKETEXPLODE):suspendedDestroy(1.0)
- uniGetTarget():executeCommand(ENC_DAMAGED)
- pause(1.0)
- bullet:destroy()
- end
-
- registerCommand(ENSCRIPTSET_ROBOT_ROCKET,ENC_FIRE1,"bullets_robotrocket_fire")
-
-
-
- function bullets_heavylaserray_fire()
- local bullet = uniGetExecutor()
- bullet:setTransformOwner()
- bullet:play3DSound("robot_heavylaserfire.wav",0):destroy()
- local light = bullet:addSimpleEffect(ENET_EFFECT_LIGHT_BLUELASERBOLTFLY)
- local track = bullet:addSimpleEffect(ENET_EFFECT_PS_HEAVYLASERRAY_RED)
- waitDeath(bullet:addMoveEffect(ENET_EFFECT_MOVE_LINEARFLY,2500,uniGetTarget()),1000)
- light:destroy()
- track:suspendedDestroy(1.5)
- local hit_ps = bullet:addSimpleEffect(ENET_EFFECT_PS_HEAVYLASERRAY_RED_HIT)
- pause(0.5)
- hit_ps:suspendedDestroy(1.0)
- uniGetTarget():executeCommand(ENC_DAMAGED)
- pause(1.0)
- bullet:destroy()
- end
-
- registerCommand(ENSCRIPTSET_BULLET_HEAVYLASERRAY_RED,ENC_FIRE1,"bullets_heavylaserray_fire")
-
- -- register new unit to logic
- unitDesc = logic_getUnitDescP(1)
- unitDesc.group = 0
- unitDesc.order = 3
- unitDesc.unit_res_id = ENET_UNIT_ROBOT
- unitDesc.unit_icon_id = "Robot_h_small_normal.dds"
- unitDesc.active_id = "Robot_h_small_active.dds"
- unitDesc.pressed_id = "Robot_h_small_pressed.dds"
- unitDesc.big_icon_id = "Robot_h_big_normal.dds"
- unitDesc.small_icon_id = "Robot_u_stats.dds"
- unitDesc.HP = 7
- unitDesc.MP = 20
- unitDesc.WR = 2
- unitDesc.min_WR = 1
- unitDesc.WD = 3
- unitDesc.WR2 = 0
- unitDesc.min_WR2 = 0
- unitDesc.WD2 = 0
- unitDesc.ability = 1
- unitDesc.transport = 0
- unitDesc.value = 4
- unitDesc.race = 0
- unitDesc.fire_pause = 0.6
- unitDesc.move_pause = 0.7
- unitDesc.unit_info_scale = 0.07
- unitDesc.scn_name = "HBOT"
-
-
-